<template>
<div>
  <h2>我是gege开{{car}}</h2>
  <button @click="changeCar">点击换车</button>
</div>
</template>


<script>
import PubSub from "pubsub-js"
export default {
name:"Gege",
  data(){
    return{
      car:"五菱"
      }
    },
  methods:{
    changeCar(){
      this.car = "宝马";

      PubSub.publish("getCar",this.car)
    }
  }
}
</script>


<style></style>